package com.oscarmovie.dao;

import java.util.List;

import org.hibernate.Query;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.oscarmovie.model.Audio;

public class AudioDaoImpl extends HibernateDaoSupport implements AudioDao {

	
	public void save(Audio audio) {
		getSession().saveOrUpdate(audio);
	}

	public Audio load(int id) {
		Audio audio = (Audio)getSession().load(Audio.class, id);
		return audio;
	}
	
	
	public List<Audio> loadAll() {
		Query query = getSession().createQuery("from Audio");
		query.setCacheable(true);
		List<Audio> list = (List<Audio>)query.list();
		return list;
	}
	
}
